package com.mail.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mail.pojo.TeamMember;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface TeamMemberMapper extends BaseMapper<TeamMember> {
    /**
     * 删除某个团队下的所有成员
     * 删除依据：团队id
     */
    @Delete("delete from team_member where team_id=#{teamId}")
    void deleteTeamMemberByTeam(@Param("teamId") long teamId);

    /**
     * 根据teamId，memberId查询相关信息
     */
    @Select("select count(*) from team_member where team_id =#{teamId} and member_id=#{memberId}")
    Integer queryIsNull(@Param("teamId") long teamId,@Param("memberId") long memberId);
}
